﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DatabaseComponent;
using Shohdi.DataHandler;
using System.Data;
using System.Data.Common;
using System.IO;
using CrystalDecisions.CrystalReports.Engine;

public partial class ReportsEN : System.Web.UI.Page
{
    
    public List<OrgnizationChart> mlstOrganization
    {
        get
        {
            if (ViewState["mlstOrganization"] == null)
                ViewState["mlstOrganization"] = System.Guid.NewGuid().ToString();
            return Session[ViewState["mlstOrganization"].ToString()] as List<OrgnizationChart>;
        }
        set
        {
            if (ViewState["mlstOrganization"] == null)
                ViewState["mlstOrganization"] = System.Guid.NewGuid().ToString();
            Session[ViewState["mlstOrganization"].ToString()] = value;
        }
    }



    public List<Persons> mlstPersons
    {
        get
        {
            if (ViewState["mlstPersons"] == null)
                ViewState["mlstPersons"] = System.Guid.NewGuid().ToString();
            return Session[ViewState["mlstPersons"].ToString()] as List<Persons>;
        }
        set
        {
            if (ViewState["mlstPersons"] == null)
                ViewState["mlstPersons"] = System.Guid.NewGuid().ToString();
            Session[ViewState["mlstPersons"].ToString()] = value;
        }
    }

    public List<Courses> mlstCourses
    {
        get
        {
            if (ViewState["mlstCourses"] == null)
                ViewState["mlstCourses"] = System.Guid.NewGuid().ToString();
            return Session[ViewState["mlstCourses"].ToString()] as List<Courses>;
        }
        set
        {
            if (ViewState["mlstCourses"] == null)
                ViewState["mlstCourses"] = System.Guid.NewGuid().ToString();
            Session[ViewState["mlstCourses"].ToString()] = value;
        }
    }
   


    ReportsDataSet mobjReportsDataSet
    {
        get
        {
            if (ViewState["mobjReportsDataSet"] == null)
                ViewState["mobjReportsDataSet"] = System.Guid.NewGuid().ToString();
            return Session[ViewState["mobjReportsDataSet"].ToString()] as ReportsDataSet;
        }

        set
        {
            if (ViewState["mobjReportsDataSet"] == null)
                ViewState["mobjReportsDataSet"] = System.Guid.NewGuid().ToString();
            Session[ViewState["mobjReportsDataSet"].ToString()] = value;
        }
    }




    Persons mobjPersons
    {
        get
        {
            if (ViewState["mobjPersons"] == null)
                ViewState["mobjPersons"] = System.Guid.NewGuid().ToString();
            return Session[ViewState["mobjPersons"].ToString()] as Persons;
        }
        set
        {
            if (ViewState["mobjPersons"] == null)
                ViewState["mobjPersons"] = System.Guid.NewGuid().ToString();
            Session[ViewState["mobjPersons"].ToString()] = value;
        }
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            checkSecurityAndCustomizePage();

            bindCombo();

            mcDateFrom.set(DateTime.Now);
            mycDateTo.set(DateTime.Now);

            dvNoOfParticipationCoursesForEmployees.Visible = true;

        }
        else
        {
            ifReport.Style["display"] = "none";
        }

    }


    /// <summary>
    /// this function will bind the combo of reports
    /// </summary>
    private void bindCombo()
    {

        List<ReportTitle> lstComboBind = generateReportNames();



        ddlReports.DataSource = lstComboBind;
        ddlReports.DataTextField = "title";
        ddlReports.DataValueField = "ID";

        ddlReports.DataBind();


    }


    /// <summary>
    /// this function will generate reportnames and desk
    /// </summary>
    /// <returns>report names</returns>
    private static List<ReportTitle> generateReportNames()
    {
        List<ReportTitle> lstComboBind = new List<ReportTitle>();
        lstComboBind.Add(new ReportTitle { ID = 1, title = "No. of Participations by Session Status", desc = "(No. of Sessions both completed and not completed)" });
        lstComboBind.Add(new ReportTitle { ID = 2, title = "No. of Users by Session Status", desc = "(Each employee is counted once regardless of his sessions' status)" });
        lstComboBind.Add(new ReportTitle { ID = 3, title = "No. of Participations by Nationality", desc = "(Includes both completed and completed participations)" });
        lstComboBind.Add(new ReportTitle { ID = 4, title = "No. of Users by Nationality", desc = "(Each employee is counted once regardless of his sessions' status)" });
        lstComboBind.Add(new ReportTitle { ID = 5, title = "No. of Participations by Course Title", desc = "(Includes both completed and completed participations)" });
        lstComboBind.Add(new ReportTitle { ID = 6, title = "No. of Participations by Business Line", desc = "(Includes both completed and completed participations distributed by operation area)" });
        lstComboBind.Add(new ReportTitle { ID = 7, title = "No. of Users by Buisness Line", desc = "(Each employee is counted once regardless of his sessions' status and distributed by operation area)" });
        lstComboBind.Add(new ReportTitle { ID = 8, title = "No. of Participations - Completed by Business Line", desc = "(No. of completed sessions by business line and distributed by operation area)" });
        lstComboBind.Add(new ReportTitle { ID = 9, title = "No. of Users - Completed  by Business Line", desc = "( No. of Users who completed one course or more by business line and distributed by operation area)" });
        lstComboBind.Add(new ReportTitle { ID = 10, title = "No of Participations by Course", desc = "(No. of completed sessions by course and distributed by operation area)" });
        lstComboBind.Add(new ReportTitle { ID = 11, title = "No. of Completed Paticipations in a year", desc = "" });
        lstComboBind.Add(new ReportTitle { ID = 12, title = "No. of Users Completed Courses in a year", desc = "" });
        lstComboBind.Add(new ReportTitle { ID = 13, title = "List of Courses without enrollment", desc = "This report lists all the courses that had no registerd users" });
        lstComboBind.Add(new ReportTitle { ID = 14, title = "List of The Highest Used 10 Courses", desc = "This report lists the most ten used courses for a specific period" });
        lstComboBind.Add(new ReportTitle { ID = 15, title = "List of The Least  Used  10 Courses", desc = "This report lists the least ten used courses for a specific period" });
        lstComboBind.Add(new ReportTitle { ID = 16, title = "No. of Users Who Access or Completed a Specific Course", desc = "This report shows the number of users for a course gouped in either Completed or not completed" });
        lstComboBind.Add(new ReportTitle { ID = 17, title = "Display the Last Date of Usage for a Specific Course", desc = "This Report shows the date of last usage for a specific course in both completed and not completed status" });
        lstComboBind.Add(new ReportTitle { ID = 18, title = "Display No. of Times a Specific User Accessed Courses", desc = "This report shows how many times a specific user accessed courses including his relatives" });
        lstComboBind.Add(new ReportTitle { ID = 19, title = "Display No. of Times a Specific User Completed Courses", desc = "This report shows how many times a specific user completed courses including his relatives" });
        lstComboBind.Add(new ReportTitle { ID = 20, title = "Display No. of Times a Specific User Accessed a Quiz Before Completion", desc = "This report shows the number of attempting quizes before success" });
        lstComboBind.Add(new ReportTitle { ID = 21, title = "No. of Courses a User has Completed or Accessed", desc = "" });
        lstComboBind.Add(new ReportTitle { ID = 22, title = "No of Participations in a department", desc = "This report shows the participations in a specific department" });
        lstComboBind.Add(new ReportTitle { ID = 23, title = "No. of Users participate in a department", desc = "" });
        lstComboBind.Add(new ReportTitle { ID = 24, title = "Name of Users Participate in a Department", desc = "This reporst shows the name of the users who participate in a specific department includes the status of the course" });
        lstComboBind.Add(new ReportTitle { ID = 25, title = "عدد المشاركات و المستفيدين لكل منطقة حسب النشاط", desc = "" });
        lstComboBind.Add(new ReportTitle { ID = 26, title = "عدد المشاركات و المستفيدين لكل منطقة حسب نوع الدورة", desc = "" });
        lstComboBind.Add(new ReportTitle { ID = 27, title = "عدد المشاركات و المسفيدين لكل منطقة حسب الجنسية", desc = "" });

        lstComboBind.Add(new ReportTitle { ID = 28, title = "عدد المشاركات بالتفصيل", desc = "" });
        
        return lstComboBind;
    }

    


    /// <summary>
    /// this function will check the security and customize the page
    /// </summary>
    private void checkSecurityAndCustomizePage()
    {
        mobjPersons = GlobalVars.getCurrentPerson();

        if (!mobjPersons.lstAllRulesIDs.Contains((long)RulesEnum.Reports_page))
            Response.Redirect("LoginEN.aspx");

        btnExcel.Visible = false;
        btnPDF.Visible = false;
    }



    protected void btnShow_Click(object sender, EventArgs e)
    {

        ifReport.Style["display"] = "none";


        //crvReport.Visible = true;

        if (ddlReports.SelectedValue == "1")
            showReport1();

        if (ddlReports.SelectedValue == "2")
            showReport2();
        
        if (ddlReports.SelectedValue == "3")
            showReport3();


        if (ddlReports.SelectedValue == "4")
            showReport4();


        if (ddlReports.SelectedValue == "5")
            showReport5();

        if (ddlReports.SelectedValue == "6")
            showReport6();
        
        
        if (ddlReports.SelectedValue == "7")
            showReport7();


        if (ddlReports.SelectedValue == "8")
            showReport8();

        if (ddlReports.SelectedValue == "9")
            showReport9();

        if (ddlReports.SelectedValue == "10")
            showReport10();

        if (ddlReports.SelectedValue == "11")
            showReport11();

        if (ddlReports.SelectedValue == "12")
            showReport12();

        if (ddlReports.SelectedValue == "13")
            showReport13();

        if (ddlReports.SelectedValue == "14")
            showReport14();

        if (ddlReports.SelectedValue == "15")
            showReport15();

        if (ddlReports.SelectedValue == "25")
            showReport25();
        if (ddlReports.SelectedValue == "26")
            showReport26();
        if (ddlReports.SelectedValue == "27")
            showReport27();
        if (ddlReports.SelectedValue == "28")
            showReport28();
    }



    /// <summary>
    /// this function will show all details for all employees
    /// </summary>
    public void showReport28()
    {
        bool bEmployee = true;
        string strEmployee = "موظفين";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "عوائل";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        //bool isCompleted = chkCompleted.Checked;

        //string strComplete = "لم تكتمل بعد";
        //if (isCompleted)
        //    strComplete = "مكتملة";





        DataTable dtNew = StoredProceduresClass.getReportUserDetails(dtFrom.Value, dtTo.Value, bEmployee);


        ReportsDataSet rds = new ReportsDataSet();

        foreach (DataRow dr in dtNew.Rows)
        {
            DataRow drNew = rds.ReportFullDetails.NewReportFullDetailsRow();
            for (int i = 0; i < dtNew.Columns.Count; i++)
            {
                drNew[i] = dr[i];
            }
            rds.ReportFullDetails.AddReportFullDetailsRow((ReportsDataSet.ReportFullDetailsRow)drNew);
        }







        //rsReport.Report.FileName = Server.MapPath("./Reports/ReportFullDetails.rpt");
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportFullDetails.rpt"));



        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        //CrystalDecisions.CrystalReports.Engine.TextObject txtMainTitle = rnp.ReportDefinition.ReportObjects["txtMainTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        //txtMainTitle.Text = "الجنسية";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");


        txtTitle.Text = generateReportNames()[26].title + " (" + strEmployee + ")";



        txtDescription.Text = generateReportNames()[26].desc;






        mobjReportsDataSet = rds;


        setReportOptions(rnp);



    }


    /// <summary>
    /// this function will show report no of users and Registered for Saudi by area
    /// </summary>
    public void showReport27()
    {
        bool bEmployee = true;
        string strEmployee = "موظفين";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "عوائل";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        bool isCompleted = chkCompleted.Checked;

        string strComplete = "لم تكتمل بعد";
        if (isCompleted)
            strComplete = "مكتملة";





        DataTable dtNew = StoredProceduresClass.getReportNoOfUsersSaudiArea(dtFrom.Value, dtTo.Value, bEmployee, isCompleted);


        ReportsDataSet rds = new ReportsDataSet();

        foreach (DataRow dr in dtNew.Rows)
        {
            DataRow drNew = rds.ReportSectorArea.NewReportSectorAreaRow();
            for (int i = 0; i < dtNew.Columns.Count; i++)
            {
                drNew[i] = dr[i];
            }
            rds.ReportSectorArea.AddReportSectorAreaRow((ReportsDataSet.ReportSectorAreaRow)drNew);
        }







        //rsReport.Report.FileName = Server.MapPath("./Reports/ReportAreaSector.rpt");
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportAreaSector.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtMainTitle = rnp.ReportDefinition.ReportObjects["txtMainTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        txtMainTitle.Text = "الجنسية";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");


        txtTitle.Text = generateReportNames()[26].title + " (" + strComplete + ") " + " (" + strEmployee + ")";



        txtDescription.Text = generateReportNames()[26].desc;






        mobjReportsDataSet = rds;


        setReportOptions(rnp);



    }


    /// <summary>
    /// this function will show report no of users and Registered for Course Type by area
    /// </summary>
    public void showReport26()
    {
        bool bEmployee = true;
        string strEmployee = "موظفين";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "عوائل";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        bool isCompleted = chkCompleted.Checked;

        string strComplete = "لم تكتمل بعد";
        if (isCompleted)
            strComplete = "مكتملة";





        DataTable dtNew = StoredProceduresClass.getReportNoOfUsersFoldersArea(dtFrom.Value, dtTo.Value, bEmployee, isCompleted);


        ReportsDataSet rds = new ReportsDataSet();

        foreach (DataRow dr in dtNew.Rows)
        {
            DataRow drNew = rds.ReportSectorArea.NewReportSectorAreaRow();
            for (int i = 0; i < dtNew.Columns.Count; i++)
            {
                drNew[i] = dr[i];
            }
            rds.ReportSectorArea.AddReportSectorAreaRow((ReportsDataSet.ReportSectorAreaRow)drNew);
        }







        //rsReport.Report.FileName = Server.MapPath("./Reports/ReportAreaSector.rpt");
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportAreaSector.rpt"));

        


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtMainTitle = rnp.ReportDefinition.ReportObjects["txtMainTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        txtMainTitle.Text = "نوع الدورة";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");


        txtTitle.Text = generateReportNames()[25].title + " (" + strComplete + ") " + " (" + strEmployee + ")";



        txtDescription.Text = generateReportNames()[25].desc;






        mobjReportsDataSet = rds;


        setReportOptions(rnp);



    }


    /// <summary>
    /// this function will show report no of users and Registered for sector by area
    /// </summary>
    public void showReport25()
    {
        bool bEmployee = true;
        string strEmployee = "موظفين";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "عوائل";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        bool isCompleted = chkCompleted.Checked;

        string strComplete = "لم تكتمل بعد";
        if (isCompleted)
            strComplete = "مكتملة";





        DataTable dtNew = StoredProceduresClass.getReportNoOfUsersSectorsArea(dtFrom.Value, dtTo.Value, bEmployee, isCompleted);


        ReportsDataSet rds = new ReportsDataSet();

        foreach (DataRow dr in dtNew.Rows)
        {
            DataRow drNew = rds.ReportSectorArea.NewReportSectorAreaRow();
            for (int i = 0;i<dtNew.Columns.Count ; i++)

            {
                drNew[i] = dr[i];
            }
            rds.ReportSectorArea.AddReportSectorAreaRow((ReportsDataSet.ReportSectorAreaRow)drNew);
        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportAreaSector.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtMainTitle = rnp.ReportDefinition.ReportObjects["txtMainTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        txtMainTitle.Text = "النشاط";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");


        txtTitle.Text = generateReportNames()[24].title + " ("+ strComplete +") " +  " (" + strEmployee + ")";



        txtDescription.Text = generateReportNames()[24].desc;






        mobjReportsDataSet = rds;


        setReportOptions(rnp);



    }




    /// <summary>
    /// this function will show report Persons Particepation in a department
    /// </summary>
    /// <param name="OrgID">This is the department choosed from grid</param>
    public void showReport24(long OrgID)
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        OrgnizationChartDB objOrgnizationChartDB = new OrgnizationChartDB(ConnectionStrings.LMS);

        List<OrgnizationChart> lstOrgs = objOrgnizationChartDB.getOrgnizationChartByID(OrgID);

        if (lstOrgs.Count == 0)
        {
            return;
        }


        bool bDated = false;

        if (mcDateFrom.get() != null || mycDateTo.get() != null)
            bDated = true;


        DateTime? dtFrom = new DateTime(2000, 1, 1);

        DateTime? dtTo = DateTime.Now.AddYears(10);

        if (bDated)
        {
            dtFrom = mcDateFrom.get();
            dtTo = mycDateTo.get();


            if (dtFrom == null)
            {
                lblError.Text = "You must enter an start date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }

            if (dtTo == null)
            {
                lblError.Text = "You must enter an end date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }


            if (dtTo.Value < dtFrom.Value)
            {
                lblError.Text = "The end date must be greater than the start date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }
        }



        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DeptID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = OrgID;


        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateFrom";
        lstParameters[1].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@DateTo";
        lstParameters[2].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsEmployee";
        lstParameters[3].Value = bEmployee;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportDepartmentEmpOne]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportDepartmentRow drNew = rds.ReportDepartment.NewReportDepartmentRow();

            drNew.PersonName = dr["NameEN"].ToString();

            drNew.Badge = dr["Badge"].ToString();

            drNew.Completed = long.Parse(dr["Completed"].ToString());

            drNew.UnCompleted = long.Parse(dr["NotCompleted"].ToString());

            drNew.NotStarted = long.Parse(dr["NotStarted"].ToString());

            drNew.SumOfRow = long.Parse(dr["SumOfRow"].ToString());










            rds.ReportDepartment.AddReportDepartmentRow(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportDepartmentDetails.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtTitle.Text =  generateReportNames()[23].title + " \r\nDepartment : " + lstOrgs[0].NameEN;//+ " (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[23].desc;


        if (bDated)
        {
            txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
            txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        }
        else
        {
            txtFromHead.Text = "";
            txtToHead.Text = "";

        }

        txtYearTitle.Text = "";



        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }




    /// <summary>
    /// this function will show report No of persons particepate in a department 
    /// </summary>
    /// <param name="OrgID">This is the department choosed from grid</param>
    public void showReport23(long OrgID)
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        OrgnizationChartDB objOrgnizationChartDB = new OrgnizationChartDB(ConnectionStrings.LMS);

        List<OrgnizationChart> lstOrgs = objOrgnizationChartDB.getOrgnizationChartByID(OrgID);

        if (lstOrgs.Count == 0)
        {
            return;
        }


        bool bDated = false;

        if (mcDateFrom.get() != null || mycDateTo.get() != null)
            bDated = true;


        DateTime? dtFrom = new DateTime(2000, 1, 1);

        DateTime? dtTo = DateTime.Now.AddYears(10);

        if (bDated)
        {
            dtFrom = mcDateFrom.get();
            dtTo = mycDateTo.get();


            if (dtFrom == null)
            {
                lblError.Text = "You must enter an start date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }

            if (dtTo == null)
            {
                lblError.Text = "You must enter an end date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }


            if (dtTo.Value < dtFrom.Value)
            {
                lblError.Text = "The end date must be greater than the start date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }
        }



        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DeptID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = OrgID;


        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateFrom";
        lstParameters[1].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@DateTo";
        lstParameters[2].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsEmployee";
        lstParameters[3].Value = bEmployee;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportDepartmentEmp]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportDepartmentRow drNew = rds.ReportDepartment.NewReportDepartmentRow();

            drNew.CourseType = dr["FolderNameEN"].ToString();

            drNew.Completed = long.Parse(dr["Completed"].ToString());

            drNew.UnCompleted = long.Parse(dr["NotCompleted"].ToString());

            drNew.NotStarted = long.Parse(dr["NotStarted"].ToString());

            drNew.SumOfRow = long.Parse(dr["SumOfRow"].ToString());










            rds.ReportDepartment.AddReportDepartmentRow(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportDepartmentReg.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtTitle.Text = generateReportNames()[22].title  +   " \r\nDepartment : " + lstOrgs[0].NameEN + " (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[22].desc;

        if (bDated)
        {
            txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
            txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        }
        else
        {
            txtFromHead.Text = "";
            txtToHead.Text = "";

        }

        txtYearTitle.Text = "";



        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }





    /// <summary>
    /// this function will show report No of registerations in a department 
    /// </summary>
    /// <param name="OrgID">This is the department choosed from grid</param>
    public void showReport22(long OrgID)
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        OrgnizationChartDB objOrgnizationChartDB = new OrgnizationChartDB(ConnectionStrings.LMS);

        List<OrgnizationChart> lstOrgs = objOrgnizationChartDB.getOrgnizationChartByID(OrgID);

        if (lstOrgs.Count == 0)
        {
            return;
        }


        bool bDated = false;

        if (mcDateFrom.get() != null || mycDateTo.get() != null)
            bDated = true;


        DateTime? dtFrom = new DateTime(2000, 1, 1);

        DateTime? dtTo = DateTime.Now.AddYears(10);

        if (bDated)
        {
            dtFrom = mcDateFrom.get();
            dtTo = mycDateTo.get();


            if (dtFrom == null)
            {
                lblError.Text = "You must enter an start date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }

            if (dtTo == null)
            {
                lblError.Text = "You must enter an end date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }


            if (dtTo.Value < dtFrom.Value)
            {
                lblError.Text = "The end date must be greater than the start date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }
        }



        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DeptID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = OrgID;


        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateFrom";
        lstParameters[1].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@DateTo";
        lstParameters[2].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsEmployee";
        lstParameters[3].Value = bEmployee;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportDepartmentReg]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportDepartmentRow drNew = rds.ReportDepartment.NewReportDepartmentRow();

            drNew.CourseType = dr["FolderNameEN"].ToString();

            drNew.Completed = long.Parse(dr["Completed"].ToString());

            drNew.UnCompleted = long.Parse(dr["NotCompleted"].ToString());

            drNew.NotStarted = long.Parse(dr["NotStarted"].ToString());

            drNew.SumOfRow = long.Parse(dr["SumOfRow"].ToString());










            rds.ReportDepartment.AddReportDepartmentRow(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportDepartmentReg.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;




        txtTitle.Text = generateReportNames()[21].title +  " \r\nDepartment : " + lstOrgs[0].NameEN + " (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[21].desc;


        if (bDated)
        {
            txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
            txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        }
        else
        {
            txtFromHead.Text = "";
            txtToHead.Text = "";

        }

        txtYearTitle.Text = "";



        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }





    /// <summary>
    /// this function will show report Which courses user have been registered 
    /// </summary>
    /// <param name="PersonsID">the person genid to build report for</param>
    public void showReport21(long PersonsID)
    {
        bool bDated = false;

        if (mcDateFrom.get() != null || mycDateTo.get() != null)
            bDated = true;


        DateTime? dtFrom = new DateTime(2000,1,1);

        DateTime? dtTo = DateTime.Now.AddYears(10);

        if (bDated)
        {
            dtFrom = mcDateFrom.get();
            dtTo = mycDateTo.get();


            if (dtFrom == null)
            {
                lblError.Text = "You must enter an start date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }

            if (dtTo == null)
            {
                lblError.Text = "You must enter an end date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }


            if (dtTo.Value < dtFrom.Value)
            {
                lblError.Text = "The end date must be greater than the start date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
                return;
            }
        }



        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@PersonsID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = PersonsID;


        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateFrom";
        lstParameters[1].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@DateTo";
        lstParameters[2].Value = dtTo.Value;

        //lstParameters.Add(con.createParameter());
        //lstParameters[1].ParameterName = "@IsEmployee";
        //lstParameters[1].Value = true;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportUserNoOfRegComp]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportUsersRow drNew = rds.ReportUsers.NewReportUsersRow();

            drNew.UserName = dr["NameEN"].ToString();
            drNew.NoOfAccess = long.Parse(dr["regCount"].ToString());
            drNew.NoOfCompletion = long.Parse(dr["compCount"].ToString());










            rds.ReportUsers.Rows.Add(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportUserNoOfRegComp.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;




        txtTitle.Text = generateReportNames()[20].title;
        txtDescription.Text = generateReportNames()[20].desc;


        if (bDated)
        {
            txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
            txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        }
        else
        {
            txtFromHead.Text = "";
            txtToHead.Text = "";
            
        }

        txtYearTitle.Text = "";



        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }



    /// <summary>
    /// this function will show report How many times a user accessed a quiz/test/assessment before successfully completing it
    /// </summary>
    /// <param name="PersonsID">the person genid to build report for</param>
    public void showReport20(long PersonsID)
    {

        
        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@PersonsID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = PersonsID;



        //lstParameters.Add(con.createParameter());
        //lstParameters[1].ParameterName = "@IsEmployee";
        //lstParameters[1].Value = true;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportUserCourseNoOfAccessBeforeCompletion]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportUsersRow drNew = rds.ReportUsers.NewReportUsersRow();

            drNew.UserName = dr["NameEN"].ToString();
            drNew.CourseName = dr["CourseNameEN"].ToString();
            drNew.NoOfAccess = long.Parse(dr["NoOfAccess"].ToString());










            rds.ReportUsers.Rows.Add(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath("./Reports/ReportUserNoOfAccessBeforeCompletion.rpt");
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportUserNoOfAccessBeforeCompletion.rpt"));

       


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;



        txtTitle.Text = generateReportNames()[19].title;
        txtDescription.Text = generateReportNames()[19].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = "";




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }



    /// <summary>
    /// this function will show report How many times a specific user completed a course successfully
    /// </summary>
    /// <param name="PersonsID">the person genid to build report for</param>
    public void showReport19(long PersonsID)
    {

        
        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@PersonsID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = PersonsID;



        //lstParameters.Add(con.createParameter());
        //lstParameters[1].ParameterName = "@IsEmployee";
        //lstParameters[1].Value = true;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportUserCourseNoOfCompletion]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportUsersRow drNew = rds.ReportUsers.NewReportUsersRow();

            drNew.UserName = dr["NameEN"].ToString();
            drNew.CourseName = dr["CourseNameEN"].ToString();
            drNew.NoOfCompletion = long.Parse(dr["NoOfCompletion"].ToString());










            rds.ReportUsers.Rows.Add(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportUserNoOfCompletion.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        txtTitle.Text = generateReportNames()[18].title;
        txtDescription.Text = generateReportNames()[18].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = "";




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }


    /// <summary>
    /// this function will show report How many times a specific user accessed a course
    /// </summary>
    /// <param name="PersonsID">the person genid to build report for</param>
    public void showReport18(long PersonsID)
    {
        

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@PersonsID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = PersonsID;



        //lstParameters.Add(con.createParameter());
        //lstParameters[1].ParameterName = "@IsEmployee";
        //lstParameters[1].Value = true;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportUserCourseNoOfAccess]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportUsersRow drNew = rds.ReportUsers.NewReportUsersRow();

            drNew.UserName = dr["NameEN"].ToString();
            drNew.CourseName = dr["CourseNameEN"].ToString();
            drNew.NoOfAccess = long.Parse(dr["NoOfAccess"].ToString());



            






            rds.ReportUsers.Rows.Add(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportUserNoOfAccess.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtTitle.Text = generateReportNames()[17].title;
        txtDescription.Text = generateReportNames()[17].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = "";




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }



    /// <summary>
    /// this function will show report Last date a specific course was taken
    /// </summary>
    /// <param name="pCourseID">the course id to generate its report</param>
    public void showReport17(long pCourseID)
    {
        

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@CourseID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = pCourseID;



        //lstParameters.Add(con.createParameter());
        //lstParameters[1].ParameterName = "@IsEmployee";
        //lstParameters[1].Value = true;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportCourseDate]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportCourseDatesRow drNew = rds.ReportCourseDates.NewReportCourseDatesRow ();




            drNew.CourseName = dr["CourseNameEN"].ToString();
            if (dr["LastAccessed"] != DBNull.Value)
                drNew.DateOfLastAccess = (DateTime)dr["LastAccessed"];


            if (dr["LastCompleted"] != DBNull.Value)
                drNew.DateOfLastCompleted = (DateTime)dr["LastCompleted"];






            rds.ReportCourseDates.Rows.Add(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/CourseDateReport.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;



        txtTitle.Text = generateReportNames()[16].title;
        txtDescription.Text = generateReportNames()[16].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = "";




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }


    /// <summary>
    /// this function will show report Number of users who completed a specific course
    /// </summary>
    /// <param name="pCourseID">the course id to generate its report</param>
    public void showReport16(long pCourseID)
    {

        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }
        

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@CourseID";
        lstParameters[0].DbType = DbType.Int64;
        lstParameters[0].Value = pCourseID;



        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@IsEmployee";
        lstParameters[1].Value = bEmployee;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportCourseNoOfUsers]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfUsersCompletedCouseRow drNew = rds.ReportNoOfUsersCompletedCouse.NewReportNoOfUsersCompletedCouseRow();




            drNew.CourseName = dr["CourseNameEN"].ToString();
            drNew.NoOfUsersRegistered = long.Parse(dr["NoOfUsersReg"].ToString());
            drNew.NoOfUsersCompleted = long.Parse(dr["NoOfUsersComp"].ToString());


            rds.ReportNoOfUsersCompletedCouse.Rows.Add(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/CoursesReport.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtTitle.Text = generateReportNames()[15].title + " (" + strEmployee + ")";

        txtDescription.Text = generateReportNames()[15].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = "";




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }


    /// <summary>
    /// this function will show report Bottom 5 courses
    /// </summary>
    public void showReport15()
    {
        

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@Asc";
        lstParameters[0].DbType = DbType.Boolean;
        lstParameters[0].Value = 1;



        //lstParameters.Add(con.createParameter());
        //lstParameters[1].ParameterName = "@IsEmployee";
        //lstParameters[1].Value = true;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportFiveCourses]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.TopFiveCoursesRow drNew = rds.TopFiveCourses.NewTopFiveCoursesRow();



            drNew.CourseName = dr["CourseNameEN"].ToString();
            drNew.CourseType = dr["FolderNameEN"].ToString();
            drNew.NoOfUsersRegistered = long.Parse(dr["NoOfUsers"].ToString());


            rds.TopFiveCourses.Rows.Add(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportTopBottomCourses.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;




        txtTitle.Text = generateReportNames()[14].title;
        txtDescription.Text = generateReportNames()[14].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = "";




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }



    /// <summary>
    /// this function will show report Top 1-5 courses
    /// </summary>
    public void showReport14()
    {

        
        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@Asc";
        lstParameters[0].DbType = DbType.Boolean;
        lstParameters[0].Value = 0;



        //lstParameters.Add(con.createParameter());
        //lstParameters[1].ParameterName = "@IsEmployee";
        //lstParameters[1].Value = true;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportFiveCourses]", CommandType.StoredProcedure,lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.TopFiveCoursesRow drNew = rds.TopFiveCourses.NewTopFiveCoursesRow();



            drNew.CourseName = dr["CourseNameEN"].ToString();
            drNew.CourseType = dr["FolderNameEN"].ToString();
            drNew.NoOfUsersRegistered = long.Parse(dr["NoOfUsers"].ToString());


            rds.TopFiveCourses.Rows.Add(drNew);

        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportTopBottomCourses.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        txtTitle.Text = generateReportNames()[13].title;
        txtDescription.Text = generateReportNames()[13].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = "";




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }


    /// <summary>
    /// this function will show report Which courses had no users registered ever
    /// </summary>
    public void showReport13()
    {
       

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        //List<DbParameter> lstParameters = new List<DbParameter>();
        //lstParameters.Add(con.createParameter());
        //lstParameters[0].ParameterName = "@Year";
        //lstParameters[0].Value = long.Parse(txtYear.Text);



        //lstParameters.Add(con.createParameter());
        //lstParameters[1].ParameterName = "@IsEmployee";
        //lstParameters[1].Value = true;

        //lstParameters.Add(con.createParameter());
        //lstParameters[2].ParameterName = "@IsAll";
        //lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNotRegisteredCourses]", CommandType.StoredProcedure);


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportCoursesNotRegisteredRow drNew = rds.ReportCoursesNotRegistered.NewReportCoursesNotRegisteredRow();



            drNew.CourseName = dr["CourseNameEN"].ToString();
            drNew.CourseType = dr["FolderNameEN"].ToString();



            rds.ReportCoursesNotRegistered.AddReportCoursesNotRegisteredRow(drNew);
        }







        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportCoursesNotRegistered.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        
        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;



        txtTitle.Text = generateReportNames()[12].title;
        txtDescription.Text = generateReportNames()[12].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = "";




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }




    /// <summary>
    /// this function will show report No. of Users Completed Courses in a year
    /// </summary>
    public void showReport12()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }
        

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@Year";
        lstParameters[0].Value = long.Parse(txtYear.Text);



        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@IsEmployee";
        lstParameters[1].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsAll";
        lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfUsersCompletedParticipationsYear]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();



            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        ((ReportsDataSet.ReportNoOfParticipationAreaRow)rds.ReportNoOfParticipationArea.Rows[0]).Desc = "First Quarter";
        ((ReportsDataSet.ReportNoOfParticipationAreaRow)rds.ReportNoOfParticipationArea.Rows[1]).Desc = "Secound Quarter";
        ((ReportsDataSet.ReportNoOfParticipationAreaRow)rds.ReportNoOfParticipationArea.Rows[2]).Desc = "Third Quarter";
        ((ReportsDataSet.ReportNoOfParticipationAreaRow)rds.ReportNoOfParticipationArea.Rows[3]).Desc = "Forth Quarter";


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));
        

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtDescHead.Text = txtYear.Text;

        //txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        //txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[11].title + " ("+strEmployee+")";
        txtDescription.Text = generateReportNames()[11].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = txtYear.Text;




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }



    /// <summary>
    /// this function will show report No. of Completed Paticipations in a year
    /// </summary>
    public void showReport11()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }
        

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@Year";
        lstParameters[0].Value = long.Parse(txtYear.Text);

        

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@IsEmployee";
        lstParameters[1].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsAll";
        lstParameters[2].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfCompletedParticipationsYear]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        ((ReportsDataSet.ReportNoOfParticipationAreaRow)rds.ReportNoOfParticipationArea.Rows[0]).Desc = "First Quarter";
        ((ReportsDataSet.ReportNoOfParticipationAreaRow)rds.ReportNoOfParticipationArea.Rows[1]).Desc = "Secound Quarter";
        ((ReportsDataSet.ReportNoOfParticipationAreaRow)rds.ReportNoOfParticipationArea.Rows[2]).Desc = "Third Quarter";
        ((ReportsDataSet.ReportNoOfParticipationAreaRow)rds.ReportNoOfParticipationArea.Rows[3]).Desc = "Forth Quarter";


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

       

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtFromHead = rnp.ReportDefinition.ReportObjects["txtFromHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtToHead = rnp.ReportDefinition.ReportObjects["txtToHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtYearTitle = rnp.ReportDefinition.ReportObjects["txtYearTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtDescHead.Text = txtYear.Text;

        //txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        //txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[10].title + " ("+ strEmployee +")";
        txtDescription.Text = generateReportNames()[10].desc;



        txtFromHead.Text = "";
        txtToHead.Text = "";
        txtYearTitle.Text = txtYear.Text;




        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }


    /// <summary>
    /// this function will show report No. of Completed Paticipations in every course
    /// </summary>
    public void showReport10()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
        lstParameters[2].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfParticipationByCourseCompleted]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            drNew.Desc = dr["CourseNameEN"].ToString();

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;



        txtDescHead.Text = "Course Name";

        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[9].title +" (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[9].desc;



        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }


    /// <summary>
    /// this function will show report No. of users Completed courses by bussiness line
    /// </summary>
    public void showReport9()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
        lstParameters[2].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfUsersParticipateByBussinessLinesCompleted]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            drNew.Desc = dr["OrgNameEN"].ToString();

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtDescHead.Text = "Bussiness Line";

        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text =  generateReportNames()[8].title + " (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[8].desc;







        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }



    /// <summary>
    /// this function will show report No. of Completed participation by bussiness line
    /// </summary>
    public void showReport8()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }


        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
        lstParameters[2].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfParticipationBussinessLinesCompleted]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            drNew.Desc = dr["OrgNameEN"].ToString();

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        txtDescHead.Text = "Bussiness Line";

        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[7].title +  " (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[7].desc;







        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }




    /// <summary>
    /// this function will show report No. of users participate in every bussiness line 
    /// </summary>
    public void showReport7()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
           // crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
                //crvReport.Visible = false;
                btnPDF.Visible = false;
                btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
        lstParameters[2].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfUsersParticipateByBussinessLines]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            drNew.Desc = dr["OrgNameEN"].ToString();

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtDescHead.Text = "Bussiness Line";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[6].title + " (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[6].desc;







        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }



    /// <summary>
    /// this function will show report No. of participation by bussiness line 
    /// </summary>
    public void showReport6()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }


        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
        lstParameters[2].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfParticipationBussinessLines]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            drNew.Desc = dr["OrgNameEN"].ToString();

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;



        txtDescHead.Text = "Bussiness Line";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[5].title +" (" + strEmployee + ")";

        txtDescription.Text = generateReportNames()[5].desc;







        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }



    /// <summary>
    /// this function will show report No. of users participate in every course 
    /// </summary>
    public void showReport5()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }


        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
        lstParameters[2].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfParticipationByCourse]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            drNew.Desc = dr["CourseNameEN"].ToString();

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));


        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;

        txtDescHead.Text = "Course Name";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text =  generateReportNames()[4].title  + " (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[4].desc;







        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }


    /// <summary>
    /// this function will show report No. of users participate by nationality 
    /// </summary>
    public void showReport4()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
        lstParameters[2].Value = bEmployee;

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfParticipationUserNationality]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {

            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            if ((bool)dr["IsSaudi"])
                drNew.Desc = "Saudi";
            else
                drNew.Desc = "Not Saudi";

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString());
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath();
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtDescHead.Text = "Nationality";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[3].title + " (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[3].desc;






        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }






    /// <summary>
    /// this function will show report No. of participation by nationality 
    /// </summary>
    public void showReport3()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
        
        
        lstParameters[2].Value = bEmployee;

        

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfParticipationCourseNationality]", CommandType.StoredProcedure, lstParameters.ToArray());


        DataTable newData = new DataTable();
        newData.Load(dtNew);

        dtNew.Close();
        ReportsDataSet rds = new ReportsDataSet();
        //rds.ReportNoOfParticipationArea.Load(dtNew);

        foreach (DataRow dr in newData.Rows)
        {
            
            ReportsDataSet.ReportNoOfParticipationAreaRow drNew = rds.ReportNoOfParticipationArea.NewReportNoOfParticipationAreaRow();

            if ((bool)dr["IsSaudi"])
                drNew.Desc = "Saudi";
            else
                drNew.Desc = "Not Saudi";

            drNew.East = long.Parse(dr["East"].ToString());
            drNew.West = long.Parse(dr["West"].ToString()) ;
            drNew.Central = long.Parse(dr["Central"].ToString());
            drNew.South = long.Parse(dr["South"].ToString());
            drNew.RowSum = long.Parse(dr["RowSum"].ToString());



            rds.ReportNoOfParticipationArea.AddReportNoOfParticipationAreaRow(drNew);
        }


        //rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of Employees participate but not completed courses";
        //rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of Employees participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath("");
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtDescHead.Text = "Nationality";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[2].title;

        txtDescription.Text = generateReportNames()[2].desc;
        

        txtTitle.Text = txtTitle.Text + " ("+ strEmployee +") ";






        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }


    /// <summary>
    /// this function will show report No. of Employees participate
    /// </summary>
    private void showReport2()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
       
        lstParameters[2].Value = bEmployee;
       

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfPersonsCourseArea]", CommandType.StoredProcedure, lstParameters.ToArray());


        ReportsDataSet rds = new ReportsDataSet();
        rds.ReportNoOfParticipationArea.Load(dtNew);

        dtNew.Close();

        


        rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of "+ strEmployee +" participate but not completed courses";
        rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of "+ strEmployee +" participate and completed courses";

        //rsReport.Report.FileName = Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt");
        
        //ReportDocument rnp = rsReport.ReportDocument;


        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));

        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;


        txtDescHead.Text = "Course Status";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");
        txtTitle.Text = generateReportNames()[1].title +" (" + strEmployee + ")";
        txtDescription.Text = generateReportNames()[1].desc;







        mobjReportsDataSet = rds;



        setReportOptions(rnp);
    }

    


    /// <summary>
    /// this function will show report No. of participation (Courses) for Employees
    /// </summary>
    public void showReport1 ()
    {
        bool bEmployee = true;
        string strEmployee = "Employees";

        if (rbFamily.Checked)
        {
            bEmployee = false;
            strEmployee = "Family";
        }

        DateTime? dtFrom = mcDateFrom.get();
        DateTime? dtTo = mycDateTo.get();


        if (dtFrom == null)
        {
            lblError.Text = "You must enter an start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        if (dtTo == null)
        {
            lblError.Text = "You must enter an end date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }


        if (dtTo.Value < dtFrom.Value)
        {
            lblError.Text = "The end date must be greater than the start date!";
            //crvReport.Visible = false;
            btnPDF.Visible = false;
            btnExcel.Visible = false;
            return;
        }

        ClassDataHandler con = new ClassDataHandler(ConnectionStrings.LMS);

        List<DbParameter> lstParameters = new List<DbParameter>();
        lstParameters.Add(con.createParameter());
        lstParameters[0].ParameterName = "@DateFrom";
        lstParameters[0].Value = dtFrom.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[1].ParameterName = "@DateTo";
        lstParameters[1].Value = dtTo.Value;

        lstParameters.Add(con.createParameter());
        lstParameters[2].ParameterName = "@IsEmployee";
       
            lstParameters[2].Value = bEmployee;
        

        lstParameters.Add(con.createParameter());
        lstParameters[3].ParameterName = "@IsAll";
        lstParameters[3].Value = false;


        DbDataReader dtNew = con.SelectDataReader("[dbo].[getReportNoOfParticipationCourseArea]", CommandType.StoredProcedure, lstParameters.ToArray());


        ReportsDataSet rds = new ReportsDataSet();
        rds.ReportNoOfParticipationArea.Load(dtNew);

        dtNew.Close();

        rds.ReportNoOfParticipationArea.Rows[0]["Desc"] = "No. of participation not completed";
        rds.ReportNoOfParticipationArea.Rows[1]["Desc"] = "No. of participation completed";


        //rsReport.Report.FileName = Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt");
        //ReportDocument rnp = rsReport.ReportDocument;

        ReportDocument rnp = new ReportDocument();
        rnp.Load(Server.MapPath("./Reports/ReportNoOfParticipationArea.rpt"));



        CrystalDecisions.CrystalReports.Engine.TextObject txtDateFrom = rnp.ReportDefinition.ReportObjects["txtDateFrom"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDateTo = rnp.ReportDefinition.ReportObjects["txtDateTo"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtTitle = rnp.ReportDefinition.ReportObjects["txtTitle"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescHead = rnp.ReportDefinition.ReportObjects["txtDescHead"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        CrystalDecisions.CrystalReports.Engine.TextObject txtDescription = rnp.ReportDefinition.ReportObjects["txtDescription"] as CrystalDecisions.CrystalReports.Engine.TextObject;
        txtDescHead.Text = "Course Status";



        txtDateFrom.Text = dtFrom.Value.ToString("dd/MM/yyyy");
        txtDateTo.Text = dtTo.Value.ToString("dd/MM/yyyy");


        txtTitle.Text = generateReportNames()[0].title + " (" + strEmployee + ")";



        txtDescription.Text = generateReportNames()[0].desc;






        mobjReportsDataSet = rds;


        setReportOptions(rnp);
       

       
    }

    /// <summary>
    /// this function will set the report options
    /// </summary>
    /// <param name="rnp">the report to add to report viewer</param>
    public void setReportOptions(ReportDocument rnp)
    {
        ifReport.Style["display"] = "block";
        rnp.SetDataSource(mobjReportsDataSet);
        rnp.Refresh();
        

        
        
        //rsReport.ReportDocument.SetDataSource(mobjReportsDataSet);
        //rsReport.ReportDocument.Refresh();

        

        //rnp.SetDataSource(mobjReportsDataSet);
        //rnp.Refresh();

        //mobjReport = rnp;

        //crvReport.Width = Unit.Pixel(840);
        //crvReport.DisplayGroupTree = false;

        //crvReport.HasToggleGroupTreeButton = false;

        //crvReport.DisplayToolbar = true;
       // crvReport.PageZoomFactor = 95;

        //if (ddlReports.SelectedValue == "28")
           // crvReport.PageZoomFactor = 75;


        //crvReport.HasCrystalLogo = false;

        //crvReport.ReportSourceID = "rsReport";
        //crvReport.DataBind();

        //crvReport.Visible = true;
        btnPDF.Visible = true;
        btnExcel.Visible = true;



        Session["rnp"] = rnp;

        Stream sm = rnp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        byte[] btNew = new byte[sm.Length];
        sm.Read(btNew, 0, btNew.Length);
        sm.Close();

        string guid = Guid.NewGuid().ToString();

        Session[guid] = btNew;


        ifReport.Attributes["src"] = "GetReportFile.ashx?ID=" + guid + "&EXT=pdf";


        //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowReport", "window.open ('GetReportFile.ashx?ID="+ guid +"&EXT=pdf','Report','width=800,height=600');", true);
               
        
        

       

        
    }

   

   

    protected void btnPDF_Click(object sender, EventArgs e)
    {
        //if (mobjReport == null)
        //{
        //    lblError.Text = "No Report to print , Please search first";
        //    btnPDF.Visible = false;
        //    btnExcel.Visible = false;
        //    return;
        //}


        //try
        //{
        //    DirectoryInfo di = new DirectoryInfo(Server.MapPath("./TempFiles"));

        //    FileInfo[] fiArr = di.GetFiles();

        //    foreach (FileInfo fi in fiArr)
        //    {
        //        if (fi.CreationTime < DateTime.Now.AddHours(-2))
        //        {
        //            fi.Delete();
        //        }
        //    }
        //}
        //catch
        //{
        //}

        //try
        //{
        //    string strFileName = System.Guid.NewGuid().ToString() + ".Pdf";
        //    //mobjReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Server.MapPath("./TempFiles/" + strFileName));
        //    //rsReport.ReportDocument.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Server.MapPath("./TempFiles/" + strFileName));
        //    //Response.Redirect("./TempFiles/" + strFileName);
        //}
        //catch
        //{
        //}

        ReportDocument rnp = (ReportDocument)Session["rnp"];
        Session["rnp"] = rnp;

        Stream sm = rnp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        byte[] btNew = new byte[sm.Length];
        sm.Read(btNew, 0, btNew.Length);
        sm.Close();

        string guid = Guid.NewGuid().ToString();

        Session[guid] = btNew;

        Response.Redirect("GetReportFile.ashx?ID=" + guid + "&EXT=pdf");

        //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowReport", "window.open ('GetReportFile.ashx?ID=" + guid + "&EXT=pdf','Report','width=800,height=600');", true);


    }
    protected void btnExcel_Click(object sender, EventArgs e)
    {
        //if (mobjReport == null)
        //{
        //    lblError.Text = "No Report to print , Please search first";
        //    btnPDF.Visible = false;
        //    btnExcel.Visible = false;
        //    return;
        //}


        //try
        //{
        //    DirectoryInfo di = new DirectoryInfo(Server.MapPath("./TempFiles"));

        //    FileInfo[] fiArr = di.GetFiles();

        //    foreach (FileInfo fi in fiArr)
        //    {
        //        if (fi.CreationTime < DateTime.Now.AddHours(-2))
        //        {
        //            fi.Delete();
        //        }
        //    }
        //}
        //catch
        //{
        //}


        //try
        //{
        //    string strFileName = System.Guid.NewGuid().ToString() + ".xls";
        //    //mobjReport.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Server.MapPath("./TempFiles/" + strFileName));
        //    //rsReport.ReportDocument.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.Excel, Server.MapPath("./TempFiles/" + strFileName));
        //    //Response.Redirect("./TempFiles/" + strFileName);
        //}
        //catch
        //{
        //}


        ReportDocument rnp = (ReportDocument)Session["rnp"];
        Session["rnp"] = rnp;

        Stream sm = rnp.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
        byte[] btNew = new byte[sm.Length];
        sm.Read(btNew, 0, btNew.Length);
        sm.Close();

        string guid = Guid.NewGuid().ToString();

        Session[guid] = btNew;

        Response.Redirect("GetReportFile.ashx?ID=" + guid + "&EXT=xls");

        //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowReport", "window.open ('GetReportFile.ashx?ID=" + guid + "&EXT=xls','Report','width=800,height=600');", true);


    }
    protected void ddlReports_SelectedIndexChanged(object sender, EventArgs e)
    {
        hideAllReports();
        if (ddlReports.SelectedValue == "1" || ddlReports.SelectedValue == "2" || ddlReports.SelectedValue == "3" || ddlReports.SelectedValue == "4" || ddlReports.SelectedValue == "5" || ddlReports.SelectedValue == "6" || ddlReports.SelectedValue == "7" || ddlReports.SelectedValue == "8" || ddlReports.SelectedValue == "9" || ddlReports.SelectedValue == "10" || ddlReports.SelectedValue == "28")
        {

            dvNoOfParticipationCoursesForEmployees.Visible = true;
            dvFamily.Visible = true;
        }
        else if (ddlReports.SelectedValue == "11" || ddlReports.SelectedValue == "12")
        {
            dvYearReports.Visible = true;
            dvFamily.Visible = true;
        }

        else if (ddlReports.SelectedValue == "13" || ddlReports.SelectedValue == "14" || ddlReports.SelectedValue == "15")
        {
        }
        else if (ddlReports.SelectedValue == "16" || ddlReports.SelectedValue == "17")
        {
            dvReportCourses.Visible = true;
            btnShow.Visible = false;
            if (ddlReports.SelectedValue == "16")
                dvFamily.Visible = true;
        }
        else if (ddlReports.SelectedValue == "18" || ddlReports.SelectedValue == "19" || ddlReports.SelectedValue == "20")
        {
            dvUsersReports.Visible = true;
            btnShow.Visible = false;
        }
        else if (ddlReports.SelectedValue == "21")
        {
            dvNoOfParticipationCoursesForEmployees.Visible = true;
            dvUsersReports.Visible = true;
            btnShow.Visible = false;
        }

        else if (ddlReports.SelectedValue == "22" || ddlReports.SelectedValue == "23" || ddlReports.SelectedValue == "24")
        {
            dvNoOfParticipationCoursesForEmployees.Visible = true;
            dvDepartmentReport.Visible = true;
            btnShow.Visible = false;
            dvFamily.Visible = true;

           
        }
        else if (ddlReports.SelectedValue == "25" || ddlReports.SelectedValue == "26" || ddlReports.SelectedValue == "27")
        {
            dvNoOfParticipationCoursesForEmployees.Visible = true;
            dvFamily.Visible = true;
            dvReportsArea.Visible = true;
        }

        
        
    }


   

    /// <summary>
    /// this function will hide all reports and remove report from binding
    /// </summary>
    private void hideAllReports()
    {
        dvDepartmentReport.Visible = false;

        dvNoOfParticipationCoursesForEmployees.Visible = false;

        dvYearReports.Visible = false;

        dvReportsArea.Visible = false;
        //Courses Reports

        dvReportCourses.Visible = false;
        btnShow.Visible = true;

        //end of Courses Reports

        //Users Reports

        dvUsersReports.Visible = false;
        btnShow.Visible = true;

        //end of Users Reports

        //family selection
        dvFamily.Visible = false;
        //end of family selection

        //crvReport.Visible = false;

        btnPDF.Visible = false;
        btnExcel.Visible = false;


        
    }



    protected void grdUsers_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grdUsers.DataSource = mlstCourses;
        grdUsers.PageIndex = e.NewPageIndex;
        grdUsers.DataBind();
    }
    protected void grdUsers_RowEditing(object sender, GridViewEditEventArgs e)
    {
        long lCourseID = long.Parse(grdUsers.DataKeys[e.NewEditIndex]["ID"].ToString());


        if (ddlReports.SelectedValue == "16")
            showReport16(lCourseID);

        if (ddlReports.SelectedValue == "17")
            showReport17(lCourseID);
    }
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        //crvReport.Visible = false;
        CoursesDB objCoursesDB = new CoursesDB (ConnectionStrings.LMS);

        if (txtSearch.Text.Equals(String.Empty))
        {
            mlstCourses = objCoursesDB.Select("", "");
        }
        else
        {
            Courses objCourses = new Courses();
            objCourses.CourseNameAR = objCourses.CourseNameEN = "%" +  txtSearch.Text + "%";
            mlstCourses = objCoursesDB.SearchOrLike(objCourses);
        }

        grdUsers.DataSource = mlstCourses;
        grdUsers.DataBind();

    }
    protected void btnSearchUser_Click(object sender, EventArgs e)
    {
        //crvReport.Visible = false;
        PersonsDB objPersonsDB = new PersonsDB(ConnectionStrings.LMS);

        if (txtSearchUser.Text.Equals(String.Empty))
        {
            mlstPersons = new List<Persons>();
        }
        else
        {
            Persons objPersons = new Persons();
            objPersons.Name_AR = objPersons.Name_EN = objPersons.MiddleName_AR = objPersons.MiddleName_EN
              =  objPersons.FamilyName_AR = objPersons.FamilyName_EN = objPersons.Badge = "%" + txtSearchUser.Text + "%";
            mlstPersons = objPersonsDB.SearchOrLike(objPersons);
        }

        grdPersons.DataSource = mlstPersons;
        grdPersons.DataBind();
    }
    protected void grdPersons_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        grdPersons.DataSource = mlstPersons;
        grdPersons.PageIndex = e.NewPageIndex;
        grdPersons.DataBind();
    }
    protected void grdPersons_RowEditing(object sender, GridViewEditEventArgs e)
    {
        
        long lPersonsID = long.Parse(grdPersons.DataKeys[e.NewEditIndex]["GenID"].ToString());

        if (ddlReports.SelectedValue == "18")
            showReport18(lPersonsID);

        if (ddlReports.SelectedValue == "19")
            showReport19(lPersonsID);

        if (ddlReports.SelectedValue == "20")
            showReport20(lPersonsID);

        if (ddlReports.SelectedValue == "21")
            showReport21(lPersonsID);
        
    }
    protected void btnDepartmentSearch_Click(object sender, EventArgs e)
    {
        //crvReport.Visible = false;
        OrgnizationChartDB objOrgnizationChartDB = new OrgnizationChartDB(ConnectionStrings.LMS);

        OrgnizationChart objOrgnizationChart = new OrgnizationChart();


        
        objOrgnizationChart.ChartTypeID = 4;
        mlstOrganization = objOrgnizationChartDB.Search(objOrgnizationChart);

        if (txtDepartmentSearch.Text.Equals(String.Empty))
        {
            
        }
        else
        {

            mlstOrganization = new List<OrgnizationChart>(from obj in mlstOrganization
                                                          where
                                                              obj.NameAR.ToLower().Contains(txtDepartmentSearch.Text.ToLower()) ||
                                                              obj.NameEN.ToLower().Contains(txtDepartmentSearch.Text.ToLower()) ||
                                                              obj.OrgCode.ToLower().Contains(txtDepartmentSearch.Text.ToLower())
                                                          select obj);
                                                          


           
        }

        gvDepartments.DataSource = mlstOrganization;
        gvDepartments.DataBind();
    }
    protected void gvDepartments_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvDepartments.DataSource = mlstOrganization;
        gvDepartments.PageIndex = e.NewPageIndex;
        gvDepartments.DataBind();
    }
    protected void gvDepartments_RowEditing(object sender, GridViewEditEventArgs e)
    {
        long orgID = long.Parse(gvDepartments.DataKeys[e.NewEditIndex]["ID"].ToString());

        OrgnizationChartDB objOrgnizationChartDB = new OrgnizationChartDB(ConnectionStrings.LMS);

        List<OrgnizationChart> lstOrgs = objOrgnizationChartDB.getOrgnizationChartByID(orgID);

        if (lstOrgs.Count > 0)
        {
            if (ddlReports.SelectedValue == "22")
            {
                showReport22(orgID);
            }
            else if (ddlReports.SelectedValue == "23")
            {
                showReport23(orgID);
            }
            else if (ddlReports.SelectedValue == "24")
            {
                showReport24(orgID);
            }
        }
    }
}